You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[KAN-66] Enforce role-based access across Cruise microservices - #144
KAN-66 — Implement Role-Based Access Control, covering KAN-67 through KAN-72.
Internal service APIs previously lacked consistent checks for the eight system roles.
This change enforces permissions even when callers bypass the gateway and use service ports directly.
Technical Changes
Immutable role/permission matrix in cruise-common; reject unknown roles and undefined API families.
Shared authorization middleware returns 401 for invalid identity, 403 for insufficient permissions and 503 for identity-service outages.
Apply authorization to auth, itinerary, activity and POS. Validate JWT signature, issuer, expiry, token type, revocation and current user state through auth access-context verification.
Replace spoofable caller-role headers with the verified role. Preserve existing credential/token proof endpoint contracts.
Expose administrator role discovery and current-user permission discovery. Persist user creation/deletion audit records in the same transaction; provide deployment SQL.
Require an explicit production JWT secret. Keep the filter enabled in domain tests with explicit authenticated fixtures.
Subtasks & Commits Mapping
Subtask
Summary
Commit
Scope
KAN-67
Define roles and permissions
96051dc
Backend
KAN-68
Authorization middleware
544d4d1
Backend
KAN-69
Restrict API access and audit identity mutations
6806833
Backend
KAN-70
Permission-rule unit tests
ffccb39
Backend
KAN-71
Unauthorized and invalid-token API tests
fdd10b6
Backend
KAN-72
Cross-role access tests across four services
1b468a8
Backend
Verification & Test Evidence
Local mvn -q test: 1,953 passed; 0 failures, errors or skips across six modules.
Local mvn -q -DskipTests package: all modules package successfully.
Auth integration tests use real signed JWTs and H2 user state. Domain cross-role tests exercise the production filter and mock only remote identity verification; the introspection client has separate loopback HTTP tests.
Java 25, compiler target 21, Maven 3.9.15. Tests ran on 2 November 2026.
Review / Deployment Notes
Review the operational role matrix and apply docs/db/KAN-66-identity-audit.sql when schema changes are managed manually.
Passenger access is limited to itinerary/catalog until a trusted auth-user-to-passenger ownership mapping exists.
Revocation storage remains the existing in-memory implementation; restart-safe/distributed revocation is not claimed.
PostgreSQL deployment and browser/staging acceptance remain pending. Current CI verification is recorded in the follow-up below.
Companion frontend: the KAN-66 branch in Cruise-JavaCLass/Cruise-web.
The three unrelated bugs after the RBAC story in the source document are excluded.
Follow-up: audit null-safety, SonarCloud duplication and current main (3 November 2026)
Guard a missing user role in recordIdentityChange: persist UNKNOWN in the audit instead of throwing on .name(). Regression tests cover both create/delete paths with audit enabled; existing-role audit values stay intact.
Centralized RBAC filter registration and remote verifier wiring in cruise-common; service configuration classes now import the shared setup.
Latest local verification of auth and common: 298 tests passed. Full backend CI on the latest commit: 1,963 tests passed, 0 failures/errors/skips.
SonarCloud Quality Gate now passes: new-code duplication 0.0% (previously 3.2%, required ≤3%) and new-code coverage 82.8% (required ≥80%).
GitHub Build & Test and SonarCloud Code Analysis pass on final head b31822825e9eced5b7a2d1916bfb87b6a6664568.
The six original task commits remain intact, followed by the review fixes and main synchronization commits. This PR has not been merged; staging remains pending.
This repository does not receive automatic reviews because it has fewer than 10 stars.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 5818dd87-a1d4-4bf9-b891-deb3aefba910
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context & Motivation
KAN-66 — Implement Role-Based Access Control, covering KAN-67 through KAN-72.
Internal service APIs previously lacked consistent checks for the eight system roles.
This change enforces permissions even when callers bypass the gateway and use service ports directly.
Technical Changes
cruise-common; reject unknown roles and undefined API families.Subtasks & Commits Mapping
96051dc544d4d16806833ffccb39fdd10b61b468a8Verification & Test Evidence
mvn -q test: 1,953 passed; 0 failures, errors or skips across six modules.mvn -q -DskipTests package: all modules package successfully.Review / Deployment Notes
docs/db/KAN-66-identity-audit.sqlwhen schema changes are managed manually.Cruise-JavaCLass/Cruise-web.Follow-up: audit null-safety, SonarCloud duplication and current main (3 November 2026)
recordIdentityChange: persistUNKNOWNin the audit instead of throwing on.name(). Regression tests cover both create/delete paths with audit enabled; existing-role audit values stay intact.b31822825e9eced5b7a2d1916bfb87b6a6664568.